package com.gary.heap;

/**
 *                    是否开启逃逸分析
 * -Xms1g -Xmx1g -XX:-DoEscapeAnalysis -XX:+PrintGCDetails
 * -Xms256m -Xmx256m -XX:-DoEscapeAnalysis -XX:+PrintGCDetails
 * @author peng_rui
 * @date 2022/2/25
 */
public class StackAllocationTest {


    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        for (int i = 0; i < 10000000; i++) {
            alloc();
        }
        long end = System.currentTimeMillis();

        System.out.println( "花费时间" +( end - start ));

        try {
            Thread.sleep(100000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static void alloc() {
        User user = new User();
    }

}

class User {

}
